package Proxy_Pattern.Forum;



// -*-coding:utf-8 -*-
//人员：刘陆鑫
//班级：19软3
//学号；2019110218
public class ProxyPlay implements Play{
    private Real_Play play=new Real_Play();
    private AccessValidator accessValidator1;
    private Change change1;
    private Look look1;
    private Publish publish1;
    private Regist regist1;
    public String do_play(String use) {
        if(this.validate(use)){
         String result=play.do_play(use);
         this.regist(use);
         this.publish(use);
         this.change(use);
         this.look(use);
         return result;
        }
        else{
            this.regist(use);
            this.publish(use);
            this.change(use);
            this.look(use);
            return null;
        }
    }
    public boolean validate(String use){
        accessValidator1=new AccessValidator();
        return accessValidator1.validate(use);
    }
    public void change(String use){
        change1=new Change();
        change1.change(this.validate(use));
    }
    public void look(String use){
        look1=new Look();
        look1.look(this.validate(use));
    }
    public void publish(String use){
        publish1=new Publish();
        publish1.publish(this.validate(use));
    }
    public void regist(String use){
        regist1=new Regist();
        regist1.regist(this.validate(use));
    }
}
